<template>
  <!-- 来料检任务清单 -->
  <p-card :bordered="false">
    与《来料检任务清单》的页面逻辑一模一样，只是只显示待复核的单据，待该页面确定百分百没错后再复制至此
    <!-- 查询区域 -->
    <!-- 查询区域 -->
    <!-- 来料检验操作弹窗1开始 -->
    <!-- 来料检验操作弹窗1结束 -->
    <!-- 来料检验操作弹窗2开始 -->
    <!--<p-modal
            :visible="modalVisible"
            title="来料检验操作"
            width="80vw"
            :footer="null"
            @cancel="closeModal"
            keyboard
    >
      <h4 class="title">基础信息</h4>
      <p-form-model

              ref="baseInfoData"
              :model="baseInfoData"
              :rules="rules"
              :label-col="labelCol"
              :wrapper-col="wrapperCol"

      >
        <p-row :gutter="24">
          <p-col :span="8">
            <p-form-model-item ref="inspectBillno" label="送检单号" prop="inspectBillno">
              <p-input
                      readOnly
                      v-model="baseInfoData.inspectBillno"

              />
            </p-form-model-item>
          </p-col>
          <p-col :span="8">
            <p-form-model-item ref="sendBillno" label="送货单号" prop="sendBillno">
              <p-input
                      readOnly
                      v-model="baseInfoData.sendBillno"

              />
            </p-form-model-item>
          </p-col>
          <p-col :span="8">
            <p-form-model-item ref="workBillno" label="工单号" prop="workBillno">
              <p-input
                      readOnly
                      v-model="baseInfoData.workBillno"

              />
            </p-form-model-item>
          </p-col>
          <p-col :span="8">
            <p-form-model-item ref="mcode" label="物料编号" prop="mcode">
              <p-input
                      readOnly
                      v-model="baseInfoData.mcode"
              />
            </p-form-model-item>
          </p-col>
          <p-col :span="8">
            <p-form-model-item ref="mname" label="物料名称" prop="mname">
              <p-input
                      readOnly
                      v-model="baseInfoData.mname"
              />
            </p-form-model-item>
          </p-col>
          <p-col :span="8">
            <p-form-model-item ref="mbig" label="物料大类名称" prop="mbig">
              <p-input
                      readOnly
                      v-model="baseInfoData.mbig"

              />
            </p-form-model-item>
          </p-col>
          <p-col :span="8">
            <p-form-model-item ref="msmall" label="物料小类名称" prop="msmall">
              <p-input
                      readOnly
                      v-model="baseInfoData.msmall"

              />
            </p-form-model-item>
          </p-col>
          <p-col :span="8">
            <p-form-model-item ref="sampingMethod" label="抽检方式" prop="sampingMethod">
              <p-input
                      readOnly
                      style="color:red"
                      v-model="baseInfoData.sampingMethod"
              />
            </p-form-model-item>
          </p-col>
          <p-col :span="8">
            <p-form-model-item ref="simpleQty" label="抽检数量" prop="simpleQty">
              <p-input
                      readOnly
                      v-model="baseInfoData.simpleQty"
              />
            </p-form-model-item>
          </p-col>
          <p-col :span="8">
            <p-form-model-item ref="matSn" label="物料管理方式" prop="matSn">
              <p-input
                      readOnly
                      style="color:red"
                      v-model="baseInfoData.matSn"
              />
            </p-form-model-item>
          </p-col>
          <p-col :span="8">
            <p-form-model-item ref="custno" label="供应商编码" prop="custno">
              <p-input
                      readOnly
                      v-model="baseInfoData.custno"

              />
            </p-form-model-item>
          </p-col>
          <p-col :span="8">
            <p-form-model-item ref="custname" label="供应商名称" prop="custname">
              <p-input
                      readOnly
                      v-model="baseInfoData.custname"
              />
            </p-form-model-item>
          </p-col>
          <p-col :span="8">
            <p-form-model-item ref="sendInspectTime" label="送检时间" prop="sendInspectTime">
              <p-input
                      readOnly
                      v-model="baseInfoData.sendInspectTime"
              />
            </p-form-model-item>
          </p-col>
          <p-col :span="8">
            <p-form-model-item ref="sendInspectQty" label="送检数量" prop="sendInspectQty">
              <p-input
                      readOnly
                      v-model="baseInfoData.sendInspectQty"
              />
            </p-form-model-item>
          </p-col>

          <p-col :span="8" v-if="visible==1">

            <p-form-model-item ref="sendInspectBy" label="送检人" prop="sendInspectBy">
              <p-input
                      readOnly
                      v-model="baseInfoData.sendInspectBy"
              />
            </p-form-model-item>
          </p-col>

          <p-col :span="8">
            <p-form-model-item ref="inMethod" label="来料方式" prop="inMethod">
              &lt;!&ndash;  <p-input
                        readOnly
                  v-model="baseInfoData.inMethod"
                  @blur="
            () => {
              $refs.inMethod.onFieldBlur();
            }
          "
                />&ndash;&gt;
              <p-select
                      v-model="baseInfoData.inMethod"
                      disabled
              >
                <p-select-option :value="1">
                  进料检验
                </p-select-option>
                <p-select-option :value="2">
                  直发协同
                </p-select-option>
              </p-select>



            </p-form-model-item>
          </p-col>

          <p-col :span="8" v-if="visible==1">

            <p-form-model-item ref="currentAddress" label="当前地址" prop="currentAddress">
              <p-input
                      readOnly
                      v-model="baseInfoData.currentAddress"
              />
            </p-form-model-item>
          </p-col>


          <p-col :span="8" >

            <p-form-model-item ref="checkBy" label="检验人" prop="checkBy">
              <p-input
                      readOnly
                      v-model="baseInfoData.checkBy"
              />
            </p-form-model-item>
          </p-col>


          <p-col :span="8" v-if="visible==1">

            <p-form-model-item ref="questionRemark" label="问题备注" prop="questionRemark">
              <p-input
                      readOnly
                      v-model="baseInfoData.questionRemark"
              />
            </p-form-model-item>
          </p-col>


        </p-row>
        <p-row>
          <p-col :span="5">
            <p-tag>供应商报告*</p-tag><a>查询</a>
          </p-col>
          <p-col :span="5">
            <p-tag>物料SN详情*</p-tag><a>查询</a>
          </p-col>
          <p-col :span="5">
            <p-tag>封样图片*</p-tag><a>查询</a>
          </p-col>
          <p-col :span="5">
            <p-tag>技术规格书*</p-tag><a>查询</a>
          </p-col>
          <p-col :span="4">
            <p-tag>检验结论*</p-tag><p-span style="color:blue">合格</p-span>
          </p-col>


        </p-row>



      </p-form-model>
      <h4 class="title">基础信息</h4>
      <p-table
              :columns="modal1InspectionColumns"
              :data-source="modal1InspectionData"
              class="components-table-demo-nested"
              bordered
              :expandIcon="expandIcon"
              style="margin-top:10px;"
      >
        <a slot="photoUrl" slot-scope="text">photoUrl</a>



        <p-table
                slot="expandedRowRender"
                slot-scope="text"
                :columns="modal1InspectionInnerColumns"
                :data-source="text.detailList"
                :pagination="false"

                bordered
        >











        </p-table>

        <template slot="photoUrl" slot-scope="text">
          <p-button>{{text.photoUrl}}</p-button>
        </template>
      </p-table>

      <h4 class="title" v-if="visible==2">审批处理</h4>
      <p-form-model
              v-if="visible==2"
              ref="processProcessingData"
              :label-col="{span:2}"
              :wrapper-col="{span:12}"
              :model="baseInfoData"
              style="margin-top:12px;"
      >
        <p-row :gutter="24">
          <p-col :span="24">
            <p-form-model-item ref="operation" label="操作" prop="operation">
              <p-radio-group v-model="baseInfoData.operation">
                <p-radio :value="1">通过</p-radio>
                <p-radio :value="2">驳回</p-radio>
              </p-radio-group>
            </p-form-model-item>
          </p-col>
          <p-col :span="24">
            <p-form-model-item ref="inspectMethod" label="检验方式" prop="inspectMethod">
              <p-radio-group v-model="baseInfoData.inspectMethod">
                <p-radio :value="1">视讯检验</p-radio>
                <p-radio :value="2">驻厂检验</p-radio>
                <p-radio :value="3">检验报告审查</p-radio>
              </p-radio-group>
            </p-form-model-item>
          </p-col>
          <p-col :span="24">
            <p-form-model-item ref="questionRemark" label="备注" prop="questionRemark">
              <p-input
                      v-model="baseInfoData.remark"
                      type="textarea"
                      @blur="
          () => {
            $refs.questionRemark.onFieldBlur();
          }
        "
              />
            </p-form-model-item>
          </p-col>
          <p-col :span="24">
            <p-form-model-item ref="fileUrl" label="附件" prop="fileUrl">
              <p-button>上传</p-button>
            </p-form-model-item>
          </p-col>
        </p-row>
      </p-form-model>


    </p-modal>

    &lt;!&ndash; 来料检验操作弹窗2结束 &ndash;&gt;
    <div class="table-page-search-wrapper">
      <p-form layout="inline" @keyup.enter.native="searchQuery">
        <p-row :gutter="24">
          <p-col :xl="6" :lg="7" :md="8" :sm="24">
            <p-form-item label="送检单号">
              <p-input
                      placeholder="请输入送检单号"
                      v-model="queryParam.inspectBillno"
              ></p-input>
            </p-form-item>
          </p-col>

          <p-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <p-button type="primary" @click="searchQuery" icon="search">查询</p-button>
              <p-button
                      type="primary"
                      @click="searchReset"
                      icon="reload"
                      style="margin-left: 8px"
              >重置</p-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <p-icon :type="toggleSearchStatus ? 'up' : 'down'" />
              </a>
            </span>
          </p-col>
        </p-row>
      </p-form>
    </div>
    &lt;!&ndash; 查询区域-END &ndash;&gt;

    &lt;!&ndash; 操作按钮区域 &ndash;&gt;
    <div class="table-operator">
      &lt;!&ndash; <p-button @click="handleAdd" type="primary" icon="plus">新增</p-button> &ndash;&gt;

      <template v-if="cgButtonList && cgButtonList.length>0" v-for="(item,index) in cgButtonList">
        <p-button
                v-if=" item.optType=='js' && (item.groupTag == null || item.groupTag == '' )"
                :key=" 'cgbtn'+index "
                @click="cgButtonJsHandler(item.buttonCode)"
                type="primary"
                :icon="item.buttonIcon"
        >{{ item.buttonName }}</p-button>
        <p-button
                v-else-if=" item.optType=='action' && (item.groupTag == null || item.groupTag == '' )"
                :key=" 'cgbtn'+index "
                @click="cgButtonActionHandler(item.buttonCode)"
                type="primary"
                :icon="item.buttonIcon"
        >{{ item.buttonName }}</p-button>
      </template>

      &lt;!&ndash; 高级查询区域 &ndash;&gt;
      <j-super-query
              :fieldList="fieldList"
              ref="superQueryModal"
              @handleSuperQuery="handleSuperQuery"
      ></j-super-query>

      <p-dropdown v-for="(item,index) in groupTag" :key="index">
        <p-button>
          {{item.name}}
          <p-icon type="down" />
        </p-button>
        <p-menu slot="overlay">
          <template v-for="(items,indexs) in item.data">
            <p-menu-item
                    v-if=" items.optType=='js' "
                    :key="indexs"
                    @click="cgButtonJsHandler(items.buttonCode)"
            >
              <p-icon :type="items.buttonIcon" />
              {{items.buttonName}}
            </p-menu-item>
            <p-menu-item
                    v-else-if=" items.optType=='action' "
                    :key="indexs"
                    @click="cgButtonActionHandler(items.buttonCode)"
            >
              <p-icon :type="items.buttonIcon" />
              {{items.buttonName}}
            </p-menu-item>
          </template>
        </p-menu>
      </p-dropdown>

      <p-dropdown v-if="selectedRowKeys.length > 0">
        <p-menu slot="overlay">
          <p-menu-item key="1" @click="batchDel">
            <p-icon type="delete" />删除
          </p-menu-item>
        </p-menu>
        <p-button style="margin-left: 8px">
          批量操作
          <p-icon type="down" />
        </p-button>
      </p-dropdown>
    </div>

    &lt;!&ndash; table区域-begin &ndash;&gt;
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择
        <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>

        <span style="float:right;">
          <a @click="handleExportXls('基本信息(来料检)')">
            <p-icon type="download" />导出
          </a>
          <p-divider type="vertical" />
          <p-upload
                  name="file"
                  :showUploadList="false"
                  :multiple="false"
                  :headers="tokenHeader"
                  :action="importExcelUrl"
                  @change="handleImportExcel"
          >
            <a>
              <p-icon type="import" />导入
            </a>
          </p-upload>
          <p-divider type="vertical" />
          <a @click="loadData()">
            <p-icon type="sync" />刷新
          </a>
          <p-divider type="vertical" />
          <p-popover title="自定义列" trigger="click" placement="leftBottom" :overlay-style="getWidth">
            <template slot="content">
              <p-checkbox-group
                      @change="onColSettingsChange"
                      v-model="settingColumns"
                      :defaultValue="settingColumns"
              >
                <p-row>
                  <template v-for="(item,index) in defColumns">
                    <template v-if="item.key!='rowIndex'&& item.dataIndex!='action'">
                      <p-col :span="12">
                        <p-checkbox :value="item.dataIndex">{{ item.title }}</p-checkbox>
                      </p-col>
                    </template>
                  </template>
                </p-row>
              </p-checkbox-group>
            </template>
            <a>
              <p-icon type="setting" />自定义列
            </a>
          </p-popover>
        </span>
      </div>

      <p-table
              ref="table"
              size="middle"
              bordered
              rowKey="id"
              :columns="columns"
              :scroll="tableScroll"
              :dataSource="dataSource"
              :pagination="ipagination"
              :loading="loading"
              :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}"
              :customRow="clickThenSelect"
              @change="handleTableChange"
      >

        <div
                slot="filterDropdown"
                slot-scope="{ setSelectedKeys, selectedKeys, confirm, clearFilters, column }"
                style="padding: 8px"
        >
          <p-input
                  v-ant-ref="c => (searchInput = c)"
                  :placeholder="`请输入 ${column.title}`"
                  :value="selectedKeys[0]"
                  style="width: 188px; margin-bottom: 8px; display: block;"
                  @change="e => setSelectedKeys(e.target.value ? [e.target.value] : [])"
          />
          <p-button
                  type="primary"
                  icon="search"
                  size="small"
                  style="width: 90px; margin-right: 8px"
                  @click="() => handleSearch(selectedKeys, confirm, column.dataIndex)"
          >确认</p-button>
          <p-button size="small" style="width: 90px" @click="() => handleReset(clearFilters)">取消</p-button>
        </div>
        <div
                slot="filterDropdownDate"
                slot-scope="{ setSelectedKeys, selectedKeys, confirm, clearFilters, column }"
                style="padding: 8px"
        >
          <p-form-item :label="` ${column.title}`">
            <j-date
                    :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss"
                    placeholder="请选择开始时间"
                    class="query-group-cust"
                    v-model="queryParam[`${column.dataIndex}_begin`]"
            ></j-date>
            <span class="query-group-split-cust"></span>
            <j-date
                    :show-time="true"
                    date-format="YYYY-MM-DD HH:mm:ss"
                    placeholder="请选择结束时间"
                    class="query-group-cust"
                    v-model="queryParam[`${column.dataIndex}_end`]"
            ></j-date>
          </p-form-item>
          <p-button
                  type="primary"
                  icon="search"
                  size="small"
                  style="width: 90px; margin-right: 8px"
                  @click="() => handleSearchDate(selectedKeys, confirm, column.dataIndex)"
          >确认</p-button>
          <p-button
                  size="small"
                  style="width: 90px"
                  @click="() => handleResetDate(clearFilters,`${column.dataIndex}_begin`,`${column.dataIndex}_end`)"
          >取消</p-button>
        </div>
        <p-icon
                slot="filterIcon"
                slot-scope="filtered"
                type="search"
                :style="{ color: filtered ? '#108ee9' : undefined }"
        />



        <template slot="inspectBillno" slot-scope="text,record">
          <a v-if="record.status==1||record.status==4"  @click="clickInspectBillno(record)">{{ text }}</a>
          <div v-else>{{ text }}</div>
          &lt;!&ndash; <router-link v-if="record.status==1" :to="{path:'/work/auto/MesIncomeOperation/',query:{id:record.id,inMethod:record.inMethod}}">{{ text }}</router-link>
           <router-link v-else-if="record.status==4" :to="{path:'/work/auto/MesQcMQEdbCheck/',query:{id:record.id}}">{{ text }}</router-link>&ndash;&gt;

        </template>

        <template slot="status" slot-scope="text">
          &lt;!&ndash; <div  :color="(record.status==3||record.status==4)?'red':'black'">{{ text }}</div>&ndash;&gt;
          <div v-if="text==1" >待检</div>
          <div v-else-if="text==2" >检验完成</div>
          <div v-else-if="text==3" style="color:red" >驳回</div>
          <div v-else-if="text==4" style="color:red">待复核</div>

        </template>



        <template slot="inspectResult" slot-scope="text">
          &lt;!&ndash; <div  :color="(record.status==3||record.status==4)?'red':'black'">{{ text }}</div>&ndash;&gt;
          <div v-if="!text" >/</div>
          <div v-else-if="text==1" >合格</div>
          <div v-else-if="text==2" style="color:red">不合格</div>
        </template>


        <template slot="matStatus" slot-scope="text">
          &lt;!&ndash; <div  :color="(record.status==3||record.status==4)?'red':'black'">{{ text }}</div>&ndash;&gt;
          <div v-if="text==0" ></div>
          <div v-else-if="text==1" style="color:red">计划加急</div>
          <div v-else-if="text==2" style="color:red">加急</div>
        </template>


        <template slot="planUrgent" slot-scope="text, record">
          <div>

            <p-switch checked-children="是" un-checked-children="否" :checked="text==1?true:false" @click="changePlanUrgent(record.id)" />
          </div>
        </template>

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无此图片</span>
          <img
                  v-else
                  :src="getImgView(text)"
                  height="25px"
                  alt="图片不存在"
                  style="max-width:80px;font-size: 12px;font-style: italic;"
          />
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无此文件</span>
          <p-button
                  v-else
                  :ghost="true"
                  type="primary"
                  icon="download"
                  size="small"
                  @click="uploadFile(text)"
          >下载</p-button>
        </template>

        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>

          <p-divider type="vertical" />
          <p-dropdown>
            <a class="ant-dropdown-link">
              更多
              <p-icon type="down" />
            </a>
            <p-menu slot="overlay">
              <p-menu-item>
                <p-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </p-popconfirm>
              </p-menu-item>
              <template
                      v-if="cgButtonLinkList && cgButtonLinkList.length>0"
                      v-for="(btnItem,btnIndex) in cgButtonLinkList"
              >
                <p-menu-item :key=" 'cgbtnLink'+btnIndex " v-if="showLinkButton(btnItem,record)">
                  <a
                          href="javascript:void(0);"
                          @click="cgButtonLinkHandler(record,btnItem.buttonCode,btnItem.optType)"
                  >
                    <p-icon v-if="btnItem.buttonIcon" :type="btnItem.buttonIcon" />
                    {{ btnItem.buttonName }}
                  </a>
                </p-menu-item>
              </template>
            </p-menu>
          </p-dropdown>
        </span>
      </p-table>
    </div>

    &lt;!&ndash; <p-tabs defaultActiveKey="1">
      <p-tab-pane tab="检验项目（来料检）" key="1">
        <mes-qc-income-check-project-list :mainId="newSelectedMainId" />
      </p-tab-pane>
      <p-tab-pane tab="不合格内容(进料)" key="2" forceRender>
        <mes-qc-income-fail-list :mainId="newSelectedMainId" />
      </p-tab-pane>
    </p-tabs>&ndash;&gt;

    <mesQcIncomeBasicInfo-modal ref="modalForm" :EnhanceJS="EnhanceJS" @ok="modalFormOk"></mesQcIncomeBasicInfo-modal>
    &lt;!&ndash; 弹出窗 &ndash;&gt;
    <Fx-compontens-modal
            @ok="modalFormOk"
            ref="modalCompon"
            :getList="queryInfo"
            :title="title"
            :dictOptions="dictOptions"
    ></Fx-compontens-modal>-->
  </p-card>
</template>

<script>
  import { JeecgListMixin } from "@/mixins/JeecgListMixin";
  import { api } from "@/api/manage";
  import JSuperQuery from "@/components/jeecg/JSuperQuery.vue";
  import { filterObj } from "@/utils/util";
  import MesQcIncomeBasicInfoModal from "./modules/MesQcIncomeBasicInfoModal";
  import Vue from "vue";
  import MesQcIncomeCheckProjectList from "./MesQcIncomeCheckProjectList";
  import MesQcIncomeFailList from "./MesQcIncomeFailList";
  import {
    initDictOptions,
    filterMultiDictText,
  } from "@/components/dict/JDictSelectUtil";
  import ButtonExpHandler from "@/components/jeecgbiz/modules/ButtonExpHandler";
  import { postAction, getAction, deleteAction } from "@/api/manage";
  import FxCompontensModal from "@/components/jeecgbiz/FxCompontensModal";

  //高级查询modal需要参数
  const superQueryFieldList = [
    {
      value: "inspectBillno",
      text: "送检单号",
      type: "string",
    },
    {
      value: "mcode",
      text: "物料编码",
      type: "string",
    },
    {
      value: "mname",
      text: "物料名称",
      type: "string",
    },
    {
      value: "currentAddress",
      text: "当前地址",
      type: "string",
    },
    {
      value: "inMethod",
      text: "来料方式",
      type: "select",
      dictCode: "mes_in_method",
    },
    {
      value: "sendBillno",
      text: "送货单号",
      type: "string",
    },
    {
      value: "workBillno",
      text: "工单号",
      type: "String",
    },
    {
      value: "sendInspectQty",
      text: "送检数量",
      type: "int",
    },
    {
      value: "sendInspectTime",
      text: "送检时间",
      type: "Date",
    },
    {
      value: "inspectTimeRemain",
      text: "检验剩余时长",
      type: "BigDecimal",
    },
    {
      value: "sendInspectBy",
      text: "送检人员",
      type: "string",
    },
    {
      value: "status",
      text: "检验状态",
      type: "int",
    },
    {
      value: "inspectResult",
      text: "检验结果",
      type: "int",
    },
    {
      value: "inspectTimes",
      text: "检验次数",
      type: "int",
    },
    {
      value: "priority",
      text: "优先级",
      type: "string",
    },
    {
      value: "matStatus",
      text: "物料状态",
      type: "int",
    },
    {
      value: "planUrgent",
      text: "计划加急",
      type: "select",
      dictCode: "",
    },
    {
      value: "mbig",
      text: "物料大类",
      type: "string",
    },
    {
      value: "msmall",
      text: "物料小类",
      type: "string",
    },
    {
      value: "inspectMethod",
      text: "检验方式",
      type: "select",
      dictCode: "rc_inspect_method",
    },
    {
      value: "matSn",
      text: "物料管控方式",
      type: "string",
    },
    {
      value: "custname",
      text: "供应商信息",
      type: "string",
    },
    {
      value: "custno",
      text: "供应商代码",
      type: "string",
    },
    {
      value: "simpleQty",
      text: "抽检数量",
      type: "int",
    },
    {
      value: "pbillno",
      text: "采购单号",
      type: "string",
    },
    {
      value: "questionRemark",
      text: "问题备注",
      type: "string",
    },
    {
      value: "custReport",
      text: "供应商报告",
      type: "string",
    },
    {
      value: "photoUrl",
      text: "封样图片",
      type: "string",
    },
    {
      value: "tcsp",
      text: "技术规格书",
      type: "string",
    },
    {
      value: "fileUrl",
      text: "附件",
      type: "string",
    },
    {
      value: "currentHandler",
      text: "当前处理人",
      type: "string",
    },
    {
      value: "createBy",
      text: "创建人",
      type: "string",
    },
    {
      value: "createTime",
      text: "创建日期",
      type: "Date",
    },
    {
      value: "updateBy",
      text: "更新人",
      type: "string",
    },
    {
      value: "updateTime",
      text: "更新日期",
      type: "Date",
    },
    {
      value: "remark",
      text: "备注",
      type: "string",
    },
  ];

  export default {
    name: "MesQcIncomeBasicInfoList",
    mixins: [JeecgListMixin],
    components: {
      JSuperQuery,
      MesQcIncomeCheckProjectList,
      MesQcIncomeFailList,
      FxCompontensModal,
      MesQcIncomeBasicInfoModal,
    },
    data() {
      return {

        statusText:[
          {1:'待检'},
          {2:'检验完成'},
          {3:'驳回'},
          {4:'待复核'},
        ],
        visible: "1",
        modalVisible:false,
        labelCol: { span: 8 },
        wrapperCol: { span: 14 },
        fieldList: superQueryFieldList,
        superQueryFlag: false,
        superQueryParams: "",
        description: "基本信息(来料检)管理页面",
        EnhanceJS: "",
        cgButtonLinkList: [],
        cgButtonList: [],
        title: "", //存表名
        groupTag: [],
        queryInfo: [],
        code: "",
        // 表头
        columns: [],
        //列设置
        settingColumns: [],
        //列定义
        defColumns: [
          {
            title: "序号",
            dataIndex: "",
            key: "rowIndex",
            width: 10,
            align: "center",
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            },
          },

          {
            title: "送检单号",
            align: "center",
            dataIndex: "inspectBillno",
            scopedSlots: { customRender: 'inspectBillno' },
          },
          {
            title: "物料编码",
            align: "center",
            dataIndex: "mcode",
          },
          {
            title: "物料名称",
            align: "center",
            dataIndex: "mname",
          },
          {
            title: "当前地址",
            align: "center",
            dataIndex: "currentAddress",
          },
          {
            title: "来料方式",
            align: "center",
            dataIndex: "inMethod",
            customRender: (text) => {
              if (!text) {
                return "";
              } else {
                return filterMultiDictText(
                        this.dictOptions["inMethod"],
                        text + ""
                );
              }
            },
          },
          {
            title: "送货单号",
            align: "center",
            dataIndex: "sendBillno",
          },
          {
            title: "工单号",
            align: "center",
            dataIndex: "workBillno",
            scopedSlots: {
              filterDropdown: "filterDropdown",
              filterIcon: "filterIcon",
              customRender: "customRender",
            },
            sorter: (a, b) => a.workBillno - b.workBillno,
          },
          {
            title: "送检数量",
            align: "center",
            dataIndex: "sendInspectQty",
          },
          {
            title: "送检时间",
            align: "center",
            dataIndex: "sendInspectTime",
            customRender: function (text) {
              return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
            },
          },
          {
            title: "检验剩余时长",
            align: "center",
            dataIndex: "inspectTimeRemain",
          },
          {
            title: "送检人员",
            align: "center",
            dataIndex: "sendInspectBy",
          },
          {
            title: "检验状态",
            align: "center",
            dataIndex: "status",
            /* customRender: (text) => {
               if (!text) {
                 return "";
               } else {
                return filterMultiDictText(this.dictOptions["status"], text + "");
               }
             },*/

            scopedSlots: { customRender: 'status' },
          },
          {
            title: "检验结果",
            align: "center",
            dataIndex: "inspectResult",
            scopedSlots: { customRender: "inspectResult" },
          },
          {
            title: "检验次数",
            align: "center",
            dataIndex: "inspectTimes",
          },
          {
            title: "优先级",
            align: "center",
            dataIndex: "priority",

          },
          {
            title: "物料状态",
            align: "center",
            dataIndex: "matStatus",
            scopedSlots: { customRender: "matStatus" },
          },
          {
            title: "计划加急",
            align: "center",
            dataIndex: "planUrgent",
            scopedSlots: { customRender: "planUrgent" },
          },
          {
            title: "加急人员",
            align: "center",
            dataIndex: "urgentBy",
          },
          // {
          //   title: '创建日期',
          //   align: 'center',
          //   dataIndex: 'createTime',
          //   customRender:function (text) {
          //     return !text?"":(text.length>10?text.substr(0,10):text)
          //   },
          // },
          // {
          //   title: '更新人',
          //   align: 'center',
          //   dataIndex: 'updateBy',
          // },
          // {
          //   title: '更新日期',
          //   align: 'center',
          //   dataIndex: 'updateTime',
          //   customRender:function (text) {
          //     return !text?"":(text.length>10?text.substr(0,10):text)
          //   },
          // },
          // {
          //   title: '备注',
          //   align: 'center',
          //   dataIndex: 'remark',
          // },
          // {
          //   title: '操作',
          //   dataIndex: 'action',
          //   align: 'center',
          //   scopedSlots: { customRender: 'action' },
          // }
        ],
        url: {
          list: "/mes-quality/mesQcIncomeBasicInfo/list",
          delete: "/mes-quality/mesQcIncomeBasicInfo/delete",
          deleteBatch: "/mes-quality/mesQcIncomeBasicInfo/deleteBatch",
          exportXlsUrl: "/mes-quality/mesQcIncomeBasicInfo/exportXls",
          importExcelUrl: "/mes-quality/mesQcIncomeBasicInfo/importExcel",
          getColumns: "/mes-quality/online/cgform/api/getColumns/",
          buttonAction: "/mes-quality/online/cgform/api/doButton",
          changePlanUrgent:'/mes-quality/mesQcIncomeBasicInfo/change/plan/urgent/'
        },
        dictOptions: {
          inMethod: [],
          planUrgent: [],
        },
        /* 分页参数 */
        ipagination: {
          current: 1,
          pageSize: 10,
          pageSizeOptions: ["10", "20", "50"],
          showTotal: (total, range) => {
            return range[0] + "-" + range[1] + " 共" + total + "条";
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0,
        },
        selectedMainId: "",

        //来料操作弹窗
        modal1Visible: false,
        baseInfoData: {
          //基础信息
          inspectBillno: "001", //送检单号
          sendBillno: "", //送货单号
          sendBillnoLine: "001", //送货单行号
          mcode: "", //物料编号
          mname: "", //物料名称
          mbig: "", //物料大类名称
          msmall: "", //物料小类名称
          sampingMethod: "", //抽检方式
          simpleQty: "3", //抽检数量
          matSn: "2020-01-01", //物料管理方式
          custno: "", //供应商编码
          custname: "", //供应商名称
          sendInspectTime: 1, //送检时间
          sendInspectQty: 3, //送检数量
          checkBy: "fdafsdd", //检验人
          inMethod: "", //来料方式
          custReport: "", //供应商报告
          tcsp: "", //技术规格书
          mSnDetail: "", //物料SN详情
          photoUrl: "", //封样图片
          inspectResult: "", //检验结论
        },
        rules: {
          inspectBillno: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          sendBillno: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          sendBillnoLine: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          mcode: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          mname: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          mbig: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          msmall: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          sampingMethod: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          simpleQty: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          matSn: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          custno: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          custname: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          sendInspectTime: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          sendInspectQty: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          checkBy: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          inMethod: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          custReport: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          tcsp: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          mSnDetail: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          photoUrl: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
          inspectResult: [
            {
              required: true,
              message: "Please input Activity name",
              trigger: "blur",
            },
          ],
        },
        // 弹窗1检验项目表格数据
        modal1InspectionColumns: [
          {
            title: "序号",
            dataIndex: "",
            key: "rowIndex",
            align: "center",
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            },
          },
          { title: "抽样样本", dataIndex: "sample", key: "sample" },
          { title: "物料编码", dataIndex: "mcode", key: "mcode" },
          { title: "物料名称", dataIndex: "mname", key: "mname" },
          { title: "物料小类", dataIndex: "subcategory", key: "subcategory" },
          { title: "物料大类", dataIndex: "mcategory", key: "mcategory" },
          { title: "检验结果", dataIndex: "inspectResult", key: "inspectResult" },
          {
            title: "图片",
            key: "photoUrl",
            scopedSlots: { customRender: "photoUrl" },
          },
        ],
        modal1InspectionData: [
          {
            key: 1,
            sample: "请输入或者选择检验样本",
            mcode: "自动带出",
            mname: "自动带出",
            subcategory: "自动带出",
            mcategory: "自动带出",
            inspectResult: "根据检验项目自动判断是否合格",
            photoUrl: "上传",
          },
          {
            key: 2,
            sample: "请输入或者选择检验样本",
            mcode: "自动带出",
            mname: "自动带出",
            subcategory: "自动带出",
            mcategory: "自动带出",
            inspectResult: "根据检验项目自动判断是否合格",
            photoUrl: "上传",
          },
        ],
        modal1InspectionInnerColumns: [
          {
            title: "序号",
            dataIndex: "",
            key: "rowIndex",
            align: "center",
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            },
          },
          { title: "检验项目", dataIndex: "inspectItem", key: "inspectItem" },
          {
            title: "检验标准",
            dataIndex: "inspectStandard",
            key: "inspectStandard",
          },
          {
            title: "值类型",
            key: "valueType",
            dataIndex: "valueType",
            customRender:function(value){

              return value?value==1?"计数型":"计量型":"";
            }
          },
          { title: "标准值", dataIndex: "standardValue", key: "standardValue" },
          {
            title: "上限值",
            dataIndex: "upperValue",
            key: "upperValue",
            scopedSlots: { customRender: "upperValue" },
          },
          { title: "下限值", dataIndex: "downValue", key: "downValue" },
          { title: "参数", dataIndex: "param", key: "param" },
          {
            title: "实测值",
            dataIndex: "measuredValue",
            key: "measuredValue",
            scopedSlots: { customRender: "measuredValue" },
          },
          {
            title: "单项判定",
            dataIndex: "individualJudgment",
            key: "individualJudgment",
            customRender:function(value){

              return value?value==1?"Pass":"NG":"";
            }
          },
          {
            title: "缺陷等级",
            dataIndex: "defectLevel",
            key: "defectLevel",
            scopedSlots: { customRender: "defectLevel" },
          },
          { title: "供应商检验样本1", dataIndex: "custBook1", key: "custBook1" },
          { title: "供应商检验样本2", dataIndex: "custBook2", key: "custBook2" },
          { title: "供应商检验样本3", dataIndex: "custBook3", key: "custBook3" },
        ],
        modal1InspectionInnerData: [
          {
            key: 1,
            inspectItem: "包装外箱1",
            inspectStandard: "包装箱外观质量良好（无破损、污垢）",
            valueType: "计数型",
            standardValue: "PASS",
            upperValue: "",
            downValue: "",
            param: "/",
            measuredValue: 1,
            individualJudgment: "PASS",
            defectLevel: 1,
            custBook1: "",
            custBook2: "",
            custBook3: "",
          },
          {
            key: 2,
            inspectItem: "包装外箱1",
            inspectStandard: "包装箱外观质量良好（无破损、污垢）",
            valueType: "计数型",
            standardValue: "PASS",
            upperValue: "",
            downValue: "",
            param: "/",
            measuredValue: 1,
            individualJudgment: "PASS",
            defectLevel: 1,
            custBook1: "",
            custBook2: "",
            custBook3: "",
          },
        ],
        measuredValueOptions: [
          {
            name: "pass",
            value: 1,
          },
          {
            name: "NG",
            value: 2,
          },
        ],
        defectLevelOptions: [
          { name: "空", value: 1 },
          { name: "A", value: 2 },
          { name: "B", value: 3 },
          { name: "C", value: 4 },
          { name: "D", value: 5 },
        ],
        // 弹窗2检验项目表格数据
        modal2Visible: false,
        baseInfoData2: {
          //基础信息
          inspectBillno: "001", //送检单号
          sendBillno: "", //送货单号
          sendBillnoLine: "001", //送货单行号
          mcode: "", //物料编号
          mname: "", //物料名称
          mbig: "", //物料大类名称
          msmall: "", //物料小类名称
          sampingMethod: "", //抽检方式
          simpleQty: "3", //抽检数量
          matSn: "2020-01-01", //物料管理方式
          custno: "", //供应商编码
          custname: "", //供应商名称
          sendInspectTime: 1, //送检时间
          sendInspectQty: 3, //送检数量
          checkBy: "fdafsdd", //检验人
          inMethod: "", //来料方式
          custReport: "", //供应商报告
          tcsp: "", //技术规格书
          mSnDetail: "", //物料SN详情
          photoUrl: "", //封样图片
          inspectResult: "", //检验结论
          operation: 1, //操作
          inspectMethod: 1, //检验方式
          questionRemark: "", //备注
          fileUrl: "", //附件
        },
        modal2InspectionColumns: [
          {
            title: "序号",
            dataIndex: "key",
          },
          { title: "抽样样本", dataIndex: "sample", key: "sample" },
          { title: "物料编码", dataIndex: "mcode", key: "mcode" },
          { title: "物料名称", dataIndex: "mname", key: "mname" },
          { title: "物料小类", dataIndex: "subcategory", key: "subcategory" },
          { title: "物料大类", dataIndex: "mcategory", key: "mcategory" },
          { title: "检验结果", dataIndex: "inspectResult", key: "inspectResult" },
          {
            title: "图片",
            key: "photoUrl",
            scopedSlots: { customRender: "photoUrl" },
          },
        ],
        modal2InspectionData: [
          {
            key: 1,
            sample: "请输入或者选择检验样本",
            mcode: "自动带出",
            mname: "自动带出",
            subcategory: "自动带出",
            mcategory: "自动带出",
            inspectResult: "根据检验项目自动判断是否合格",
            photoUrl: "详情",
          },
          {
            key: 2,
            sample: "请输入或者选择检验样本",
            mcode: "自动带出",
            mname: "自动带出",
            subcategory: "自动带出",
            mcategory: "自动带出",
            inspectResult: "根据检验项目自动判断是否合格",
            photoUrl: "详情",
          },
        ],
        modal2InspectionInnerColumns: [
          {
            title: "序号",
            dataIndex: "key",
          },
          { title: "检验项目", dataIndex: "inspectItem", key: "inspectItem" },
          {
            title: "检验标准",
            dataIndex: "inspectStandard",
            key: "inspectStandard",
          },
          {
            title: "值类型",
            key: "valueType",
            scopedSlots: { customRender: "valueType" },
          },
          { title: "标准值", dataIndex: "standardValue", key: "standardValue" },
          {
            title: "上限值",
            dataIndex: "upperValue",
            key: "upperValue",
            scopedSlots: { customRender: "upperValue" },
          },
          { title: "下限值", dataIndex: "downValue", key: "downValue" },
          { title: "参数", dataIndex: "param", key: "param" },
          {
            title: "实测值",
            dataIndex: "measuredValue",
            key: "measuredValue",
          },
          {
            title: "单项判定",
            dataIndex: "individualJudgment",
            key: "individualJudgment",
          },
          {
            title: "缺陷等级",
            dataIndex: "defectLevel",
            key: "defectLevel",
          },
          // { title: "供应商检验样本1", dataIndex: "custBook1", key: "custBook1" },
          // { title: "供应商检验样本2", dataIndex: "custBook2", key: "custBook2" },
          // { title: "供应商检验样本3", dataIndex: "custBook3", key: "custBook3" },
        ],
        modal2InspectionInnerData: [
          {
            key: 1,
            inspectItem: "包装外箱1",
            inspectStandard: "包装箱外观质量良好（无破损、污垢）",
            valueType: "计数型",
            standardValue: "PASS",
            upperValue: "",
            downValue: "",
            param: "/",
            measuredValue: 1,
            individualJudgment: "PASS",
            defectLevel: 1,
            // custBook1: "",
            // custBook2: "",
            // custBook3: "",
          },
          {
            key: 2,
            inspectItem: "包装外箱1",
            inspectStandard: "包装箱外观质量良好（无破损、污垢）",
            valueType: "计数型",
            standardValue: "PASS",
            upperValue: "",
            downValue: "",
            param: "/",
            measuredValue: 1,
            individualJudgment: "PASS",
            defectLevel: 1,
            // custBook1: "",
            // custBook2: "",
            // custBook3: "",
          },
        ],




      };
    },
    computed: {
      importExcelUrl: function () {
        return `${api.test}${this.url.importExcelUrl}`;
      },
      getWidth: function () {
        if (this.defColumns.length > 14) {
          return { width: "500px" };
        }
      },
      newSelectedMainId: function () {
        if (typeof this.selectedMainId == "number") {
          return this.selectedMainId.toString();
        } else {
          return this.selectedMainId;
        }
      },
      tableScroll: function () {
        if (this.columns.length > 13) {
          return { x: this.columns.length * 150 - 450 };
        }
      },
    },

    created() {
      this.initButtonList();
      this.initColumns();
      this.setdefColumns();
    },

    methods: {
      //确定按钮
      handleSearch(selectedKeys, confirm, dataIndex) {
        confirm();
        this.searchText = selectedKeys[0];
        this.searchedColumn = dataIndex;
      },
      //取消按钮
      handleReset(clearFilters) {
        clearFilters();
        this.searchText = "";
      },
      //确定时间
      handleSearchDate(selectedKeys, confirm, dataIndex) {
        confirm();
        this.searchText = selectedKeys[0];
        this.searchedColumn = dataIndex;
        this.searchQuery();
      },
      // 清除时间
      handleResetDate(clearFilters, begin, end) {
        if (this.queryParam[begin] || this.queryParam[end]) {
          this.queryParam[begin] = "";
          this.queryParam[end] = "";
          clearFilters();
          this.searchText = "";
          this.searchQuery();
        } else {
          clearFilters();
          this.searchText = "";
        }
      },
      getKey() {
        const dataItem = [];
        setTimeout(() => {
          this.columns.forEach((item) => {
            dataItem.push({ text: item.title, value: item.dataIndex });
          });
        }, 100);
        return dataItem;
      },
      //
      getControl(dic) {
        const dataItem = [];
        initDictOptions(dic).then((res) => {
          res.data.forEach((item) => {
            dataItem.push({ text: item.text, value: item.value });
          });
        });
        return dataItem;
      },

      setdefColumns() {
        if (this.columns.length > 13) {
          let arrLength = this.columns.length - 1;
          this.columns.forEach((item, index) => {
            item["width"] = 130;
          });
          this.columns[arrLength]["fixed"] = "right";
          this.columns[0]["fixed"] = "left";
          this.columns[1]["fixed"] = "left";
        }
      },
      initColumns() {
        //权限过滤（列权限控制时打开，修改第二个参数为授权码前缀）
        //this.defColumns = colAuthFilter(this.defColumns,'testdemo:');

        var key = this.$route.name + ":colsettings";
        let colSettings = Vue.ls.get(key);
        if (colSettings == null || colSettings == undefined) {
          let allSettingColumns = [];
          this.defColumns.forEach(function (item, i, array) {
            allSettingColumns.push(item.dataIndex);
          });
          this.settingColumns = allSettingColumns;
          this.columns = this.defColumns;
        } else {
          this.settingColumns = colSettings;
          const cols = this.defColumns.filter((item) => {
            if (item.key == "rowIndex" || item.dataIndex == "action") {
              return true;
            }
            if (colSettings.includes(item.dataIndex)) {
              return true;
            }
            return false;
          });
          this.columns = cols;
        }
      },
      //列设置更改事件
      onColSettingsChange(checkedValues) {
        var key = this.$route.name + ":colsettings";
        Vue.ls.set(key, checkedValues, 7 * 24 * 60 * 60 * 1000);
        this.settingColumns = checkedValues;
        const cols = this.defColumns.filter((item) => {
          if (item.key == "rowIndex" || item.dataIndex == "action") {
            return true;
          }
          if (this.settingColumns.includes(item.dataIndex)) {
            return true;
          }
          return false;
        });
        this.columns = cols;
      },
      //高级查询方法
      handleSuperQuery(arg) {
        if (!arg) {
          this.superQueryParams = "";
          this.superQueryFlag = false;
        } else {
          this.superQueryFlag = true;
          this.superQueryParams = JSON.stringify(arg);
        }
        this.loadData();
      },
      // 获取查询条件
      getQueryParams() {
        let sqp = {};
        if (this.superQueryParams) {
          sqp["superQueryParams"] = encodeURI(this.superQueryParams);
        }
        var param = Object.assign(sqp, this.queryParam, this.isorter);
        param.field = this.getQueryField();
        param.pageNo = this.ipagination.current;
        param.limit = this.ipagination.pageSize;
        return filterObj(param);
      },
      initDictConfig() {
        initDictOptions("mes_in_method").then((res) => {
          if (res.success) {
            this.$set(this.dictOptions, "inMethod", res.data);
          }
        });
        initDictOptions("ba_yn").then((res) => {
          if (res.success) {
            this.$set(this.dictOptions, "planUrgent", res.data);
          }
        });

        initDictOptions("mes_income_status").then((res) => {
          if (res.success) {
            this.$set(this.dictOptions, "status", res.data);
          }
        });

        initDictOptions("mes_into_inspect_result").then((res) => {
          if (res.success) {
            this.$set(this.dictOptions, "inspectResult", res.data);
          }
        });

        initDictOptions("mes_mat_status").then((res) => {
          if (res.success) {
            this.$set(this.dictOptions, "matStatus", res.data);
          }
        });
      },
      closeModal(){
        this.modalVisible = false;
      },
      clickThenSelect(record, index) {
        return {
          on: {
            // click: () => {
            //   this.onSelectChange(record.id.split(","), [record]);
            // },
            dblclick: () => {
              //打开来料操作弹窗1
              /* if (index == 0) {
                 this.modal1Visible = true;
               } else {
                 this.modal2Visible = true;
               }*/

              this.visible = record.inMethod;
              this.modalVisible = true;
              let id = record.id;
              getAction('/mes-quality/mesQcIncomeBasicInfo/query/all/info/by/id/'+id).then(res=>{
                if (res.success) {
                  let data = res.data;
                  this.baseInfoData = data;
                  this.modal1InspectionData = data.checkProjectList;
                } else {
                  this.$message.warning("后台获取单据信息报错");
                }
              })
            },
          },
        };
      },
      onClearSelected() {
        this.selectedRowKeys = [];
        this.selectionRows = [];
        this.selectedMainId = "";
      },
      onSelectChange(selectedRowKeys, selectionRows) {
        this.selectedMainId = selectedRowKeys[0];
        this.selectedRowKeys = selectedRowKeys;
        this.selectionRows = selectionRows;
      },
      loadData(arg) {
        if (!this.url.list) {
          this.$message.error("请设置url.list属性!");
          return;
        }
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1;
        }
        this.onClearSelected();
        var params = this.getQueryParams(); //查询条件
        params.status=4;
        params.tableType=1;

        this.loading = true;
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            this.dataSource = res.data.records;
            this.ipagination.total = res.data.total;
          }
          if (res.code === 510) {
            this.$message.warning(res.msg);
          }
          this.loading = false;
        });
      },

      // 弹出窗组件
      showDemoModal() {
        this.$refs.modalCompon.modalShow();
      },
      // 点击btn获取数据
      btnGetData(tableName, title) {
        getAction(`${this.url.getColumns}`, {
          tableName: tableName,
        }).then((res) => {
          if (res.code == 0) {
            this.queryInfo = res.data.columns;
            this.title = title;
            this.dictOptions = res.data.dictOptions;
            this.showDemoModal();
          } else {
            this.$message.warning(res.msg);
          }
        });
      },

      //筛选分组
      getGroupTag(arrList) {
        let arr = [];
        var map = {},
                dest = [];
        arrList.forEach((item, index) => {
          if (item.groupTag) {
            arr.push(item);
          }
        });
        for (var i = 0; i < arr.length; i++) {
          var ai = arr[i];
          if (!map[ai.groupTag]) {
            dest.push({
              groupTag: ai.groupTag,
              name: ai.groupName,
              data: [ai],
            });
            map[ai.groupTag] = ai;
          } else {
            for (var j = 0; j < dest.length; j++) {
              var dj = dest[j];
              if (dj.groupTag == ai.groupTag) {
                dj.data.push(ai);
                break;
              }
            }
          }
        }
        this.groupTag = dest;
        console.log(dest);
      },
      showLinkButton(item, record) {
        let btn = new ButtonExpHandler(item.exp, record);
        return btn.show;
      },
      initButtonList() {
        getAction(`${this.url.getColumns}8ac49ec7733bce480173461726020093`).then(
                (res) => {
                  console.log("--获取自定义按钮->>", res);
                  if (res.success) {
                    this.code = res.data.code;
                    this.initCgButtonList(res.data.cgButtonList);
                    this.initCgEnhanceJs(res.data.enhanceJs);
                    this.getGroupTag(res.data.cgButtonList);
                  } else {
                    this.$message.warning(res.msg);
                  }
                }
        );
      },
      initCgEnhanceJs(enhanceJs) {
        //console.log("--onlineList-js增强",enhanceJs)
        if (enhanceJs) {
          let Obj = eval("(" + enhanceJs + ")");
          this.EnhanceJS = new Obj(getAction, postAction, deleteAction);
          this.cgButtonJsHandler("created");
        } else {
          this.EnhanceJS = "";
        }
      },
      initCgButtonList(btnList) {
        let linkArr = [];
        let buttonArr = [];
        if (btnList && btnList.length > 0) {
          for (let i = 0; i < btnList.length; i++) {
            let temp = btnList[i];
            if (temp.buttonStyle == "button") {
              buttonArr.push(temp);
            } else if (temp.buttonStyle == "link") {
              linkArr.push(temp);
            }
          }
        }
        this.cgButtonLinkList = [...linkArr];
        this.cgButtonList = [...buttonArr];
        console.log("链接增强", this.cgButtonLinkList);
      },
      cgButtonJsHandler(buttonCode) {
        if (this.EnhanceJS[buttonCode]) {
          this.EnhanceJS[buttonCode](this);
        }
      },
      cgButtonActionHandler(buttonCode) {
        //处理自定义button的 需要配置该button自定义sql
        if (!this.selectedRowKeys || this.selectedRowKeys.length == 0) {
          this.$message.warning("请先选中一条记录");
          return false;
        }
        if (this.selectedRowKeys.length > 1) {
          this.$message.warning("请只选中一条记录");
          return false;
        }
        let params = {
          formId: this.code,
          buttonCode: buttonCode,
          dataId: this.selectedRowKeys[0],
        };
        console.log("自定义按钮请求后台参数：", params);
        postAction(this.url.buttonAction, params).then((res) => {
          if (res.success) {
            this.loadData();
            this.$message.success("处理完成!");
          } else {
            this.$message.warning("处理失败!");
          }
        });
      },
      cgButtonLinkHandler(record, buttonCode, optType) {
        if (optType == "js") {
          if (this.EnhanceJS[buttonCode]) {
            this.EnhanceJS[buttonCode](this, record);
          }
        } else if (optType == "action") {
          let params = {
            formId: this.code,
            buttonCode: buttonCode,
            dataId: record.id,
          };
          console.log("自定义按钮link请求后台参数：", params);
          postAction(this.url.buttonAction, params).then((res) => {
            if (res.success) {
              this.loadData();
              this.$message.success("处理完成!");
            } else {
              this.$message.warning("处理失败!");
            }
          });
        }
      },

      changePlanUrgent(id){
        getAction(this.url.changePlanUrgent+id).then(res=>{
          if (res.success) {
            this.loadData();
            this.$message.success("处理完成!");
          } else {
            this.$message.warning("处理失败!");
          }
        })
      },

      /**
       * 展开图标
       * @param props
       * @returns {string|*}
       */
      expandIcon(props){
        if(props.record.detailList&&props.record.detailList.length>0){

          if (props.expanded) {
            return <p-icon type='minus-square' onClick={e => {props.onExpand(props.record, e);}}/>;
          }else{
            return <p-icon type='plus-square' onClick={e => {props.onExpand(props.record, e);}}/>;
          }

        }else{
          return "";
        }
      },

      clickInspectBillno(record){
        //id主键
        let id = record.id;
        //状态： “待检-1”跳到“来料检操作”     “待复核-4”跳到“MQE复核”
        let status = record.status;

        //来料方式-待检状态    “进料检验-1”   “直发协同-2”-有流程审批处理
        let inMethod = record.inMethod;

        //表类型  是否供应商
        let tableType = record.tableType;

        switch (status) {
          case 1:
            //跳转至来料检操作  参数带id,和来料方式（不带来料方式就要通过id查出来）
            /* this.$router.push("/MesIncomeOperation/id="+id+"&inMethod=")*/
            switch (tableType) {
              case 1:
                this.$router.push({path:"/work/auto/MesIncomeOperation",query:{id:id,inMethod:inMethod}})
                break;
              case 2:
                this.$router.push({path:"/work/auto/MesQcCustOutCheckOpe",query:{id:id,inMethod:inMethod}})
                break;
            }

            break;
          case 4:
            //跳转至MQE复核
            this.$router.push({path:"/work/auto/MesQcMQEdbCheck",query:{id:id}})
            break;
        }

      }




    },
  };
</script>
<style scoped>
  @import "~@assets/less/common.less";
  .title {
    padding: 8px 12px;
    background: #fafafa;
  }
  .title:not(:first-child) {
    margin-top: 25px;
  }
  /deep/ .poros-table-body {
    overflow-x: auto !important;
  }
</style>
